<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@page import="dyyx.dto.*"%>
<%@page import="dyyx.util.*"%>
<%@page import="java.util.*"%>
<%@page import="org.apache.kafka.clients.admin.*"%>
<%@page import="org.apache.kafka.common.*"%>


<%

WebResult webResult = new WebResult();
KafkaViewWebUtil.info(request, webResult);

KafkaClusterInfo clusterInfo = webResult.clusterInfo;
Map<String, TopicListing> topics  = webResult.topics;
ConsumerGroupsInfo  consumerGroupsInfo = webResult.consumerGroupsInfo;

List<KafkaBroker> brokers = webResult.brokers;
Node controller = webResult.controller;

if(clusterInfo==null){
	clusterInfo = new KafkaClusterInfo();
}

if(brokers==null){
	brokers = new ArrayList<KafkaBroker>();
}

List<ConsumerGroupDTO> consumerGroupDTOList = webResult.consumerGroupDTOList;
if(consumerGroupDTOList==null){
	consumerGroupDTOList = new ArrayList<ConsumerGroupDTO>();
}

Collection<TopicListing> topicList = null;
if(topics!=null){
    topicList = topics.values();
}

if(topicList==null){
	topicList = new ArrayList<TopicListing>();	
}

String zookeeperConnect = webResult.zookeeperConnect;




%>

<%@include file="/comm.jsp"%>

<hr>
<%=new Date() %>   
<a href="../"> HOME </a>
<br>
<%=WebUtil.showInfo(webResult.msg) %>

<hr>
<h1>clusterInfo </h1>

<table>

<tr class='title'>
   <td>clusterId</td>
   <td>server</td>
   <td>zookeeperConnect</td>
</tr>

<tr>
   <td><%=clusterInfo.clusterId %></td>
   <td><%=clusterInfo.server %> </td>
   <td>
   <%=zookeeperConnect %> <br>
   <a href="form.jsp"> kafka连接设置</a>
   
   </td>
</tr>

</table>


<hr>

<table>

<tr class='title'>

<td>id</td>
<td>isController</td>

<td>host</td>
<td>port</td>
<td>rack</td>
<td>Config</td>
<td>LogDirInfo</td>


</tr>



<%for(KafkaBroker item:brokers){ %>

<tr>
<td><%=item.id %></td>
<td><%=item.controller %></td>
<td><%=item.host %></td>
<td><%=item.port %></td>
<td><%=item.rack  %></td>
<td><a target="_blank" href="config.jsp?type=broker&brokerId=<%=item.id%>">view</a></td>
<td><a target="_blank" href="log_dir_info.jsp?brokerId=<%=item.id%>">view</a></td>

</tr>

<%} %>


</table>



<hr>
<h1>topics</h1>

<table>

<tr class='title'>
 <td>topicName</td>
 <td>Config</td>
 <td>Description</td>
 
</tr>

<%for(TopicListing item:topicList){ %>

<tr>
<td><%=item.name() %></td>

<td><a target="_blank" href="config.jsp?type=topic&name=<%=item.name()%>">view</a></td>
<td><a target="_blank" href="topic_desc.jsp?topic=<%=item.name()%>">view</a></td>

</tr>

<%} %>

</table>

<hr>
<h1>consumerGroups </h1>


<table>

<tr class='title'>
 <td>groupId</td>
 <td>simpleConsumerGroup</td>
 <td>valid</td>
 <td>Description</td>
 <td>Offset</td>
 
</tr>

<%for(ConsumerGroupDTO item:consumerGroupDTOList){ %>

<tr>
<td><%=item.groupId %></td>
<td><%=item.simpleConsumerGroup %></td>
<td><%=item.valid %></td>
<td><a target="_blank" href="consumer_group_desc.jsp?groupId=<%=item.groupId%>">view</a></td>
<td><a target="_blank" href="offset.jsp?groupId=<%=item.groupId%>">view</a></td>

</tr>

<%} %>

</table>




<hr>


<br><br><br>
